/**
   \file  train.hh
   \brief Training action for different libgist algorithms.

   This file defines a class that implements the steps required to train
   different libgist algorithms. Although libgist does not provide a
   common API across its various algorithms to effect training, the
   general steps are, in fact, the same, viz., figure out the set of
   training images from the libgist driver program's configuration system
   and the pass those images to the algorithm for training.

   Unfortunately, the "pass training image to algorithm" part in the
   above description is different for each algorithm. Luckily,
   algorithm_tester and its subclasses encapsulate these disparate API's
   behind a common API so that the training action can work in a general
   manner across all the algorithms.
*/

/*
   This file is part of libgist.

   libgist is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2 of the License, or (at your
   option) any later version.

   libgist is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
   for more details.

   You should have received a copy of the GNU General Public License
   along with libgist; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

/*
   REVISION HISTORY

   $HeadURL: http://libgist.googlecode.com/svn/branches/siagian_dev/drv/train.hh $
   $Id: train.hh 53 2011-09-01 08:09:28Z libgist@gmail.com $
*/

#ifndef GISTDRV_TRAINING_ACTION_DOT_HH
#define GISTDRV_TRAINING_ACTION_DOT_HH

//------------------------------ HEADERS --------------------------------

// gistdrv
#include "action.hh"
#include "algorithm_tester.hh"
#include "factory.hh"

//----------------------- NAMESPACE DEFINITION --------------------------

namespace gistdrv {

//------------------------- CLASS DEFINITION ----------------------------

/**
   \brief Implements the common steps required to train different
   algorithms.

   NOTE: As this class simply implements the interface specified by the
   action class, it possesses no publicly accessible interface of its
   own, i.e., all its data members and methods are private.
*/
class train: public action {
   // Boilerplate code to make factory pattern work
   friend  class subfactory<train, action, algorithm_tester*> ;
   typedef register_factory<train, action, algorithm_tester*> my_factory ;
   static  my_factory register_me ;

   /// A private constructor because these objects are created by a
   /// factory and cannot be instantiated directly by clients.
   train(algorithm_tester*) ;

   /// This method performs the steps needed to train an algorithm.
   void exec() ;

   /// Clean-up.
   ~train() ;
} ;

//-----------------------------------------------------------------------

} // end of namespace encapsulating this file's definitions

#endif

/* So things look consistent in everyone's emacs... */
/* Local Variables: */
/* indent-tabs-mode: nil */
/* End: */

